% HH observes y = pi + w
% HH belief about inflation: 
% pi(t+1) = a(t) + phi(t) * pi(t) + eta(t)
% a(t+1) = a(t) + v1(t+1)
% phi(t+1) = phi(t) + v2(t+1)

% prior: alpha, v_alpha
% param: v_eta, v_nu, v_alpha=var(v), v_w

function [K,P1] = hh_K(v_eta, v_nu1, v_nu2, v_w, P0, phi, pi, d_phi)

% P(t) = P{t|t-1}
% psi(t) = psi{t+1|t} = {pi, alpha}
% psi_t = psi{t|t}

H = [1, 0, 0];
F = [phi, 1, pi*d_phi;
     0,   1, 0;
     0,   0, 1];

R = v_w;
Q = diag([v_eta; v_nu1; v_nu2]);

K = P0 * H' / (H* P0 * H' + R);
P1 = F*(P0 - P0 * H' / (H* P0 * H' + R) * H * P0)*F' + Q;    


end